package org.xy.bean;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;

public class Bean {
	private String name;
	private String className;
	private Child child;
	private boolean singleton = false;

	public String getName() {
		return this.name;
	}

	@XmlElement(name = "name")
	public void setName(String name) {
		this.name = name;
	}

	public String getClassName() {
		return this.className;
	}

	@XmlElement(name = "class")
	public void setClassName(String className) {
		this.className = className;
	}

	public List<String> getChildNames() {
		return this.child == null ? null : this.child.getNames();
	}

	@XmlElement(name = "child")
	public void setChild(Child child) {
		this.child = child;
	}

	public boolean isSingleton() {
		return this.singleton;
	}

	@XmlElement(name = "singleton")
	public void setSingleton(boolean singleton) {
		this.singleton = singleton;
	}

	public boolean hasChild() {
		return this.child == null ? false : this.child.hasChild();
	}

	public Bean(String name, String className, String[] childNames) {
		super();
		this.name = name;
		this.className = className;
		this.child = new Child(childNames);
	}

	public Bean() {

	}
}
